 // 主脚本 - 处理页面交互
        document.addEventListener('DOMContentLoaded', function() {
            // 初始化游戏
            const game = new CangjieGame();
            
            // 游戏说明按钮
            const instructionsBtn = document.getElementById('instructions-btn');
            const instructionsModal = document.getElementById('instructions-modal');
            
            if (instructionsBtn) {
                instructionsBtn.addEventListener('click', function() {
                    instructionsModal.style.display = 'flex';
                });
            }
            
            // 键盘快捷键
            document.addEventListener('keydown', function(e) {
                // 空格键暂停/继续
                if (e.code === 'Space' && game.isGameActive) {
                    e.preventDefault();
                    game.togglePause();
                }
                
                // H键使用提示
                if (e.code === 'KeyH' && game.isGameActive && !game.isPaused) {
                    e.preventDefault();
                    game.useHint();
                }
                
                // R键重置当前关卡
                if (e.code === 'KeyR' && game.isGameActive && !game.isPaused) {
                    e.preventDefault();
                    game.resetCurrentLevel();
                }
                
                // S键打乱拼图块
                if (e.code === 'KeyS' && game.isGameActive && !game.isPaused) {
                    e.preventDefault();
                    game.shufflePieces();
                }
                
                // N键下一关
                if (e.code === 'KeyN' && game.isGameActive && !game.isPaused) {
                    e.preventDefault();
                    game.nextLevel();
                }
            });
            
            // 显示键盘快捷键提示
            setTimeout(() => {
                if (!game.isGameActive) {
                    const messageDiv = document.getElementById('message');
                    messageDiv.textContent = "提示: 使用空格键暂停，H键使用提示，R键重置关卡";
                    messageDiv.className = "message success";
                    messageDiv.style.display = "block";
                    
                    setTimeout(() => {
                        messageDiv.style.display = "none";
                    }, 5000);
                }
            }, 2000);
        });